#ifndef _SHT3X_DIS_H_
#define _SHT3X_DIS_H_
#include "stm32l0xx_hal.h"

#define FUN_16BIT_TO_8BIT(x) ((x >> 8), (x & 0xff)) 

#define POLYNOMIAL 0x131

#define RH_FORMULATE   0.0015259021

#define TEMP_FORMULATE 0.0026703288

#define SHT3X_DIS_ADDRESS  0x88 

#define CMD_SINGLE_SLOT_REPEAT_CLK_EN_MSB         0x2C
#define CMD_SINGLE_SLOT_REPEAT_CLK_DIS_MSB        0x24

#define CMD_SINGLE_SLOT_REPEAT_HIGH_CLK_EN_LSB    0x06
#define CMD_SINGLE_SLOT_REPEAT_MID_CLK_EN_LSB     0x0D
#define CMD_SINGLE_SLOT_REPEAT_LOW_CLK_EN_LSB     0x10

#define CMD_SINGLE_SLOT_REPEAT_HIGH_CLK_DIS_LSB   0x00
#define CMD_SINGLE_SLOT_REPEAT_MID_CLK_DIS_LSB    0x0B
#define CMD_SINGLE_SLOT_REPEAT_LOW_CLK_DIS_LSB    0x16

typedef enum
{
  SHT3X_DIS_OK = 0,
  SHT3X_DIS_ERROR = 1,
  SHT3X_DIS_TIMEOUT = 2,
  SHT3X_DIS_NOT_IMPLEMENTED = 3
} SHT3X_DIS_StatusTypeDef;

/*public function***********************************************************/
SHT3X_DIS_StatusTypeDef sht3x_dis_init(void);
SHT3X_DIS_StatusTypeDef sht3x_dis_read_single_slot_command(uint16_t* raw_temp, uint16_t* humiraw_hum);
#endif //_SHT3X_DIS_H_
